package com.yurun.service.impl;

import com.yurun.entity.CityVisitor;
import com.yurun.exception.PersistenceException;
import com.yurun.mapper.CityVisitorMapper;
import com.yurun.service.CityVisitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CityVisitorServiceImpl implements CityVisitorService {
    @Autowired
    CityVisitorMapper cityVisitorMapper;

    @Override
    public void addCityVisitor(CityVisitor cityVisitor){
        if(cityVisitorMapper.addCityVisitor(cityVisitor)!=1){
            throw new PersistenceException("添加城市访客失败");
        }
    }

    @Override
    public List<CityVisitor> getCityVisitorList(){
        return cityVisitorMapper.getCityVisitorList();
    }
}
